﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AgencyEntityLib.BaseEntity;


public partial class frmFileLoader : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetExpires(DateTime.Now);
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        DataBind(); 

    }
    
    protected string ImageUrl 
    { 
        get 
        {
            return "~//SidePhoto//" + sFileName;
            
        } 
    }

    protected string SaveUrl
    {
        get
        {            
            return sFolderName+sFileName; 
        }
    }

    public string SideId
    {
        get
        {
            return Request.QueryString[iAdmin_Page.qSideID] ; 
        }        
    }

    protected string ConstractionID
    {
        get { return Request.QueryString[iAdmin_Page.qConstractionID]; }
    }

    protected Constraction Constraction
    {
        get
        {
            wsConstractions _ws = (wsConstractions)GlobalConstants.CurrentAgency.WS_FactoryList[WS_FactoryList.wsKey_Constraction];                    
            
            return _ws.GetConstraction(ConstractionID);
        }
    }

    protected Side Side
    {
        get
        {
            return (Side)Constraction.SideList[SideId];
        }
    }

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string s = "";
        }
    }
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(SaveUrl);
            string s = Request.QueryString.ToString();
            Response.Redirect("frmFileLoader.aspx?" + s);
        }        
        
    }
    
    protected Unit  ImageHeight
    {
        get
        {
            Unit r= new Unit ("265px");
            return r;
        }   
    }    
    
protected string sFileName{get{return SideId.Replace("-", string.Empty) + ".jpg";}}
protected string sFolderName{get{return Server.MapPath("~\\SidePhoto\\");}}
}
